<?php

/**
 * AccountCustomer filter form base class.
 *
 * @package    erpcrm
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseAccountCustomerFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'currency_code'      => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'default_terms'      => new sfWidgetFormPropelChoice(array('model' => 'ListInvoiceTerms', 'add_empty' => true, 'key_method' => 'getTerm')),
      'status'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'remarks'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'customer_industry'  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'default_owner_iden' => new sfWidgetFormPropelChoice(array('model' => 'AccountOwner', 'add_empty' => true)),
      'tin_number'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'credit_limit'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'vat_excempt_type'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
    ));

    $this->setValidators(array(
      'currency_code'      => new sfValidatorPass(array('required' => false)),
      'default_terms'      => new sfValidatorPropelChoice(array('required' => false, 'model' => 'ListInvoiceTerms', 'column' => 'term')),
      'status'             => new sfValidatorPass(array('required' => false)),
      'remarks'            => new sfValidatorPass(array('required' => false)),
      'customer_industry'  => new sfValidatorPass(array('required' => false)),
      'default_owner_iden' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'AccountOwner', 'column' => 'contact_iden')),
      'tin_number'         => new sfValidatorPass(array('required' => false)),
      'credit_limit'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'vat_excempt_type'   => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('account_customer_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'AccountCustomer';
  }

  public function getFields()
  {
    return array(
      'contact_iden'       => 'ForeignKey',
      'currency_code'      => 'Text',
      'default_terms'      => 'ForeignKey',
      'status'             => 'Text',
      'remarks'            => 'Text',
      'customer_industry'  => 'Text',
      'default_owner_iden' => 'ForeignKey',
      'tin_number'         => 'Text',
      'credit_limit'       => 'Number',
      'vat_excempt_type'   => 'Text',
    );
  }
}
